package com.sl.au.service;

import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Sort.Direction;

import com.sl.au.entity.Division;
import com.sl.au.entity.GridAreaDetailInfo;
import com.sl.au.entity.GridAreaInfo;
import com.sl.au.entity.Point;
import com.sl.au.repository.GridAreaDetailInfoRepository;
import com.sl.au.repository.GridAreaInfoRepository;

public interface GridAreaInfoService extends BaseService {

	GridAreaInfoRepository getRepository();

	GridAreaDetailInfoRepository getDetailRepository();

	List<GridAreaInfo> getPage(int start, int length, String key, String orderName, String dir);

	void deleteById(String id);

	List<GridAreaInfo> getPageByKey(int start, int length, String key, String orderName, String dir);

	Integer getCount(String key);

	void saveSelfAndDetails(GridAreaInfo gridAreaInfo, List<GridAreaDetailInfo> detailInfos);

	void deleteSelfAndDetails(GridAreaInfo gridAreaInfo);

	Integer getBindCount(String key);

	Integer getUnbindCount(String key,String gridTypeId);

	GridAreaInfo GetGridAreaInfoByCoordinate(double longitude, double latitude);
	
	boolean JudgePolygonOverlap(List<Point> mPoints,String gridId,Map<String, Object> map);

	List<GridAreaInfo> getBindDivisionPageByKey(int start, int length, String key, String orderName, String dir);
	
	List<GridAreaInfo> getPageByArea(String gridTypeId,int start, int length, String areaId, String key,
			String orderName, Direction dir);
	List<GridAreaInfo> getPageByType(String gridTypeId,int start, int length, String key,
			String orderName, Direction dir);

	List<GridAreaInfo> getPointPageByArea(int start, int length, String areaId, String key,
			String orderName, Direction dir);
	
	int getPointPageByAreaCount(String areaId, String key);
	
	List<GridAreaInfo> getPointUnbindDivisionPageByKey(int start, int length, String key, String orderName, Direction dir);
	
	int getPointUnbindCount(String key);
	
	Integer getBindCountWithArea(String gridTypeId,String areaId,String key);

	List<GridAreaInfo> getBindDivisionPage(int start, int length, String key, String orderName, String dir);

	List<GridAreaInfo> getUnbindDivisionPageByKey(String gridTypeId,int start, int length, String key, String orderName, String dir);

	List<GridAreaInfo> getUnbindDivisionPage(String gridTypeId,int start, int length, String key, String orderName, String dir);
	
	List<GridAreaInfo> getPageByDivision(int start, int length, Division division, String orderName, String dir);

	int getCountByDivision(Division division);

	List<GridAreaInfo> getPageByDivisionAndKey(int start, int length, String divisionId, String type, String key, String orderName, String dir);
	
	int getCountByDivisionAndKey(String divisionId, String type, String key);

	List<GridAreaInfo> getGridBindUserPageByKey(int start, int length, String key,  String orderName, String dir);

	Integer getGridBindUserCount(String key);

	/*List<GridAreaInfo> getBindDivisionPageByKeyAndCon(String gridTypeId,int start, int length, String key, String con);*/

	List<GridAreaInfo> getGridBindUserPageByKeyAndCon(int start, int length, String key, String con);

	Integer getGridBindUserCountByCon(String key, String con);

	List<GridAreaInfo> findBindDivisionPageByKeyAndCon(String key, String con, int start, int length);

	Integer findBindDivisionCountByKeyAndCon(String key, String con, int start, int length);

	List<GridAreaInfo> findBindDivisionPageOnlyKey(String key, String con, int start, int length);

	Integer findBindDivisionCountOnlyKey(String key, String con, int start, int length);

	List<GridAreaInfo> findBindDivisionPageOnlyCon(String con, int start, int length);

	Integer findBindDivisionCountOnlyCon(String key, String con, int start, int length);

	List<GridAreaInfo> findBindDivisionPageNone(int start, int length);

	Integer findBindDivisionCountNone(int start, int length);

	List<GridAreaInfo> findUnbindDOnlyCon(String con, int start, int length);

	Integer findUnbindDCountOnlyCon(String con);

	List<GridAreaInfo> findUnbindDNone(int start, int length);

	Integer findUnbindDCountNone();

	List<GridAreaInfo> findUnbindDByKeyAndCon(String key, String con, int start, int length);

	Integer findUnbindDCountByKeyAndCon(String key, String con);

	List<GridAreaInfo> findUnbindOnlyKey(String key, int start, int length);

	Integer findUnbindCountOnlyKey(String key);

	GridAreaInfo findByName(String name);

}
